import { createRouter, createWebHistory } from 'vue-router'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    { path: '/login', component: () => import('@/views/Login/index.vue') },
    {
      path: '/forget',
      component: () => import('@/views/ForgetPassword/index.vue')
    },
    {
      path: '/register',
      component: () => import('@/views/Register/index.vue')
    },
    {
      path: '/',
      component: () => import('@/layout/LayoutCom.vue'),
      children: [
        { path: '', component: () => import('@/views/Home/index.vue') },
        { path: '/paper', component: () => import('@/views/Paper/index.vue') },
        {
          path: '/paper/:id',
          component: () => import('@/views/Paper/PaperInfo.vue')
        },
        { path: '/user', component: () => import('@/views/User/index.vue') },
        {
          path: '/record',
          component: () => import('@/views/Record/index.vue')
        },
        {
          path: '/record/:id',
          component: () => import('@/views/Record/RecordInfo.vue')
        },
        {
          path: '/video',
          component: () => import('@/views/Video/index.vue')
        },
        {
          path: '/video/:id',
          component: () => import('@/views/Video/VideoInfo.vue')
        },
        {
          path: '/question',
          component: () => import('@/views/Question/index.vue')
        }
      ]
    }
  ]
})
router.beforeEach(() => {
  window.scrollTo(0, 0)
  return true
})
export default router
